package com.huiquan.analysis.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huiquan.analysis.service.ExecuteRuleService;

/**
 * 规则处理 Controller
 *
 * @author leo
 * @time 2017年3月16日 下午4:15:45
 */
@Controller
@RequestMapping("/analysis/executeRule")
public class ExecuteRuleController {
	@Autowired
	private ExecuteRuleService service;

	/**
	 * 对os标注后的数据执行规则处理
	 * 
	 * @param req
	 * @param resp
	 * @return
	 * @throws IOException
	 */
	@ResponseBody
	@RequestMapping("/executeRule.do")
	public boolean executeRule(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		// 输入文件路径
		String inputFilePath = req.getParameter("inputFilePath");
		// 输出文件路径
		String outputFilePath = req.getParameter("outputFilePath");
		// 类型:1-主诉,2-现病史,3-医学影像
		int type = Integer.parseInt(req.getParameter("type"));
		return service.executeRule(inputFilePath, outputFilePath, type);
	}
}
